﻿    using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MySql.Data.MySqlClient;
using System.Data;

public partial class GiatritechnologyT : System.Web.UI.Page
{

    DropDownListHandlerAndUpdate DDL = new DropDownListHandlerAndUpdate();
    protected void Page_Load(object sender, EventArgs e)
    {
        
        Label1.Text = Variables.IDDN;
       
        DatabaseHandler db = new DatabaseHandler();
        db.connect();
        InitializingDatabaseObject ini = new InitializingDatabaseObject(db.loadAllInforByIDDN(Variables.IDDN, "tbl_t"));
        db.close();

        foreach (QuestionObject x in Variables.questionListText)
        {
            if (x != null)
            {
                string id = x.getColumnName().ToString() + "_" + x.getValue().ToString();
                ini.LoadDataToRadioButton(Page.Controls, id);
                ini.LoadDataToTextBox(Page.Controls, x.getColumnName(), x.getValue());
            }
        }
        DDL.LoadDataForT(T030A, T030B, T030C, T050A, T050B, T050C);
       
    }

    
  







   
    protected void ddl_LuaChon_SelectedIndexChanged(object sender, EventArgs e)
    {
        Response.Redirect(Redirect.redirectForComboBox(ddl_LuaChon));
    }
    protected void btn_ChiSoTiepTheo_Click(object sender, EventArgs e)
    {
        Response.Redirect("GiatriMarketing.aspx");
    }
    protected void btn_LuuThongTin_Click(object sender, EventArgs e)
    {
        ControlHandler ctHandler = new ControlHandler();
        ctHandler.GetControlList<RadioButton>(Page.Controls, Variables.checkedRadioButtonList);
        ctHandler.GetControlList<TextBox>(Page.Controls, Variables.TextBoxList);
        ctHandler.GetControlList<DropDownList>(Page.Controls, Variables.dropDLList);
        new AnalysisAndInsert("tbl_t");
        DDL.insertDataForT30(T030A, T030B, T030C);
        DDL.insertDataForT50(T050A, T050B, T050C);
        lbShow.Text = "Lưu thông tin doanh nghiệp thành công!";
    }
    
}